package x.y.z;

public class Interview_8_1_TripleStep {
    public int waysToStep(int n) {
        int mod = 1000000007;
        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        if (n == 3) {
            return 4;
        }
        int[] dp = new int[n + 1];
        dp[1] = 1;
        dp[2] = 2;
        dp[3] = 4;
        for (int i = 4; i <= n; i++) {
            dp[i] = ((dp[i - 1] % mod + dp[i - 2] % mod) % mod + dp[i - 3] % mod) % mod;
        }
        return dp[n];
    }
}
